package my.service;

import java.sql.SQLException;
import java.util.List;

import my.bean.Order;
import my.bean.Tea;
import my.bean.User;

public interface IUserService {
	/**
	 * register an user
	 * @param user
	 * @return the count of operation successfully register  USER
	 * @throws SQLException
	 */
	public int register(User user) throws SQLException;

	/**
	 * delete an user by user's id
	 * @param id
	 * @return the count of operation successfully delete from USER
	 * @throws SQLException
	 */
	public int deleteUserById(int id) throws SQLException;

	/**
	 * modify the user's base message without password 
	 * @param user
	 * @return the count of operation successfully modify
	 * @throws SQLException
	 */
	public int modifyBaseMessage(User user) throws SQLException;

	/**
	 * modify the user's password for given id and new password only
	 * @param id
	 * @param newPassword
	 * @return the count of operation successfully modify
	 * @throws SQLException
	 */
	public int modifyPasswordById(int id, String newPassword) throws SQLException;

	/**
	 * find all user
	 * @return a list off all user
	 */
	public List<User> findAll();

	/**
	 * find a list of user where user's account like 'account' 
	 * @param account
	 * @return a list of user
	 */
	public User findByAccount(String account);

	/**
	 * find an user by user's id
	 * @param id
	 * @return an user object
	 */
	public User findByUserId(int id);

	/**
	 * for given account and password to login if account and password are exist
	 * @param account
	 * @param password
	 * @return an user object
	 */
	public User login(String account, String password);
	
	public void buy(int cid,Order order,Tea tea) throws SQLException;
}
